package jzOffer;

public class Num63 {
    public int maxProfit(int[] prices) {
        if(prices.length==0) return 0;
        int min=Integer.MAX_VALUE;
        int price=0;
        for(int i=0;i<prices.length;i++){
            price=Math.max(price,prices[i]-min);
            if(prices[i]<min) min=prices[i];
        }
        return price;
    }
}
